home *** CD-ROM | disk | FTP | other *** search
/ VisualFX for ImageFX / VisualFX for Image FX 2.adf / Files / ARexx / 02 / 07.rexx < prev    next >
Encoding:
OS/2 REXX Batch file  |  1996-02-04  |  6.6 KB  |  334 lines

  1. /*
  2.                           Visual FX Arexx Script
  3.                            Written By J.L. White
  4.                          (C)1997 Merlin's Software
  5. */
  6.  
  7. Options Results
  8. address "IMAGEFX.1"
  9. ScreenToFront
  10. Undo Off
  11. if exists("libs:flyer.library") then do
  12.     TOASTERLIB="ToasterARexx.port"
  13.     call remlib('ToasterARexx.port')
  14.     call remlib('PROJECT_REXX_PORT')
  15.     call addlib('PROJECT_REXX_PORT' , 0)
  16.     call addlib(TOASTERLIB,0)
  17.     end
  18.     call Settings()
  19.     call open TempFile,"VFXIFX:TempDrawer/"FXNum".txt",R
  20.     line = readln(TempFile)
  21.     Color = strip(line)
  22.     line = readln(TempFile)
  23.     ColorPic = strip(line)
  24.     line = readln(TempFile)
  25.     PicName = strip(line)
  26.     line = readln(TempFile)
  27.     Scroll = strip(line)
  28.     line = readln(TempFile)
  29.     XOff = strip(line)
  30.     line = readln(TempFile)
  31.     YOff = strip(line)
  32.     line = readln(TempFile)
  33.     Type = strip(line)
  34.     call close (TempFile)
  35.     ActiveColor Color
  36.     ActiveColor
  37.     j = 0
  38.     TFrames = Frames
  39.     if Field = 1 then TFrames = Frames*2
  40.     do i = 1 to Frames
  41.         call open TempFile,"RAM:VFXNums",W
  42.         call writeln TempFile,right(i,5,'0')
  43.         call writeln TempFile,right(Frames,5,'0')
  44.         call close TempFile
  45.         f = 0
  46.         Redraw Off
  47.         FieldSet=0
  48.         if Padding ~= -1 & i = 1 then call PadIt(1)
  49.         call LoadB()
  50.         call LoadA()
  51.         j = j + 1
  52.         call DoIt()
  53.         Redraw On
  54.         call SaveIt()
  55.         if Field = 1 then do
  56.             Redraw Off
  57.             FieldSet=1
  58.             call LoadB()
  59.             call LoadA()
  60.             j = j + 1
  61.             call DoIt()
  62.             Redraw On
  63.             call SaveIt()
  64.             end 
  65.         if Padding ~= -1 & i = Frames then call PadIt(2)
  66.         end
  67.     if SaveType = 0 then do
  68.         if Padding = -1 then
  69.             call MakeIcon(SaveName,(Frames-10))
  70.         else
  71.             call MakeIcon(SaveName,(Padding+(Frames-10)))
  72.         end
  73.     ActiveColor 1
  74.     ActiveColor
  75.     Undo On
  76. exit
  77.  
  78.  
  79.  
  80. PadIt:
  81. arg PadNum
  82.     if (POS('FLY_1',SHOW('Ports')) = 0) then do
  83.         Undo On
  84.         exit
  85.         end
  86.          if PadNum = 1 then do
  87.        if IAType = 0 then do
  88.         do Pad = Padding to 1 by -1
  89.             LoadBuffer PicAName Force StartA-(Pad-1)
  90.             call Switcher(TOSW)
  91.             call Switcher(MDV1)
  92.             Render Go
  93.                 call RecordAdd(SaveName,2,6,Compression)
  94.             end
  95.         end
  96.        if IAType = 1 then do
  97.         LoadBuffer PicAName Force 1
  98.         call Switcher(TOSW)
  99.         call Switcher(MDV1)
  100.         Render Go
  101.             call RecordAdd(SaveName,2*Padding,6,Compression)
  102.         end
  103.        if IAType = 2 then do
  104.         LoadBuffer PicAName Force
  105.         call Switcher(TOSW)
  106.         call Switcher(MDV1)
  107.         Render Go
  108.             call RecordAdd(SaveName,2*Padding,6,Compression)
  109.         end
  110.        if IAType = 3 then do
  111.         do Pad = Padding to 1 by -1
  112.             LoadBuffer PicAName""right(StartA-(Pad-1),3,'0') Force
  113.             call Switcher(TOSW)
  114.             call Switcher(MDV1)
  115.             Render Go
  116.                 call RecordAdd(SaveName,2,6,Compression)
  117.             end
  118.         end
  119.     end 
  120.     else do
  121.        if IBType = 0 then do
  122.         do Pad = 1 to Padding
  123.             LoadBuffer PicBName Force StartB+Pad+Frames
  124.             call Switcher(TOSW)
  125.             call Switcher(MDV1)
  126.             Render Go
  127.                 call RecordAdd(SaveName,2,6,Compression)
  128.             end
  129.         end
  130.        if IBType = 1 then do
  131.         LoadBuffer PicBName Force 1
  132.         call Switcher(TOSW)
  133.         call Switcher(MDV1)
  134.         Render Go
  135.             call RecordAdd(SaveName,2*Padding,6,Compression)
  136.         end
  137.        if IBType = 2 then do
  138.         LoadBuffer PicBName Force
  139.         call Switcher(TOSW)
  140.         call Switcher(MDV1)
  141.         Render Go
  142.             call RecordAdd(SaveName,2*Padding,6,Compression)
  143.         end
  144.        if IBType = 3 then do
  145.         do Pad = 1 to Padding
  146.             LoadBuffer PicBName""right(StartB+Pad+Frames),3,'0') Force
  147.             call Switcher(TOSW)
  148.             call Switcher(MDV1)
  149.             Render Go
  150.                 call RecordAdd(SaveName,2,6,Compression)
  151.             end
  152.         end
  153.     end
  154. return
  155.  
  156.  
  157. LoadA:
  158.     if (POS('FLY_1',SHOW('Ports')) = 0) then do
  159.         Undo On
  160.         exit
  161.         end
  162.     if i > Frames/2 then return
  163.     if IAType = 0 then do
  164.         LoadBuffer PicAName Force i+StartA
  165.         GetMain
  166.         parse var result Name Width Height Blah
  167.         if FieldSet = 0 then do
  168.             Hook DeInterlace
  169.             Scale Width Height
  170.             end
  171.         if FieldSet = 1 then do
  172.             Hook DeInterlace
  173.             Swap
  174.             Scale Width Height
  175.             end
  176.         end
  177.     if IAType = 1 then do
  178.         LoadBuffer PicAName Force 1
  179.         end
  180.     if IAType = 2 then do
  181.         LoadBuffer PicAName Force
  182.         end
  183.     if IAType = 3 then do
  184.         LoadBuffer PicAName""right(i+StartA,3,'0') Force
  185.         end
  186. return
  187.  
  188. LoadB:
  189.     if (POS('FLY_1',SHOW('Ports')) = 0) then do
  190.         Undo On
  191.         exit
  192.         end
  193.     if i <= Frames/2 then return
  194.     if IBType = 0 then do
  195.         LoadBuffer PicBName Force i+StartB
  196.         GetMain
  197.         parse var result Name Width Height Blah
  198.         if FieldSet = 0 then do
  199.             Hook DeInterlace
  200.             Scale Width Height
  201.             end
  202.         if FieldSet = 1 then do
  203.             Hook DeInterlace
  204.             Swap
  205.             Scale Width Height
  206.             end
  207.         end
  208.     if IBType = 1 then do
  209.         LoadBuffer PicBName Force 1
  210.         end
  211.     if IBType = 2 then do
  212.         LoadBuffer PicBName Force
  213.         end
  214.     if IBType = 3 then do
  215.         LoadBuffer PicBName""right(i+StartB,3,'0') Force
  216.         end
  217.  
  218. return
  219.  
  220.  
  221. DoIt:
  222.     if (POS('FLY_1',SHOW('Ports')) = 0) then do
  223.         Undo On
  224.         exit
  225.         end
  226.         
  227.     Num = (((j-1) * 180)/(TFrames-1))
  228.     Num = trunc(Num)
  229.  
  230.     Num2 = 180 - (((j-1) * 180)/(TFrames-1))
  231.     Num2 = trunc(Num2)
  232.     Num2 = -Num2
  233.  
  234.     if j = 1 then do
  235.         if ColorPic = 0 then do
  236.             Buffer2Swap
  237.             Swap
  238.             GetMain
  239.             parse var result Name Width Height Blah
  240.             FillMode Solid 0 0 0 Smooth
  241.             FilledBox 0 0 Width Height
  242.             Swap
  243.             end
  244.         return
  245.         end
  246.  
  247.     if j = TFrames then do
  248.         return
  249.         end
  250.  
  251.  
  252.     if ColorPic = 0 then do
  253.         Buffer2Swap
  254.         Swap
  255.         GetMain
  256.         parse var result Name Width Height Blah
  257.         FillMode Solid 0 0 0 Smooth
  258.         FilledBox 0 0 Width Height
  259.         Swap
  260.         end
  261.  
  262.     if ColorPic = 1 then do
  263.         Swap
  264.         LoadBuffer PicName Force
  265.         if Scroll = 1 then
  266.             Roll XOff*j YOff*j
  267.         Swap
  268.         end
  269.  
  270.  
  271.     if ColorPic = 1 then Which = "SwapTile"
  272.     else Which = "DrawColor"
  273.  
  274.     if j > (TFrames/2) then do
  275.         Num = (((j-1) * 200)/(TFrames-1))
  276.         Num = trunc(200-Num)
  277.         Hook Composite Merge Num 1 0 0 MatchMain SwapScale 
  278.         end
  279.     else do
  280.         if Type = 0 then
  281.             Hook Perspective '0' '0' Num '0' '0' '0' '0' '0' 0 0 0 3 Which AntiAlias
  282.         if Type = 1 then
  283.             Hook Perspective '0' '0' Num '0' '0' '0' '0' '0' 0 0 0 4 Which AntiAlias
  284.         if Type = 2 then
  285.             Hook Perspective '0' '0' Num '0' '0' '0' '0' '0' 0 0 0 1 Which AntiAlias
  286.         if Type = 3 then
  287.             Hook Perspective '0' '0' Num '0' '0' '0' '0' '0' 0 0 0 2 Which AntiAlias
  288.         end
  289.     ActiveColor 16
  290.     Pen 0 1
  291.     Box 0 0 Width Height
  292.     ActiveColor Color
  293.  
  294. return
  295.  
  296. SaveIt:
  297.     if (POS('FLY_1',SHOW('Ports')) = 0) then do
  298.         Undo On
  299.         exit
  300.         end
  301.     if SaveType = 0 then do
  302.         call Switcher(TOSW)
  303.         call Switcher(MDV1)
  304.         Render Go
  305.         if Field = 1 then
  306.                 call RecordAdd(SaveName,1,6,Compression)
  307.         else
  308.                 call RecordAdd(SaveName,2,6,Compression)
  309.         end
  310.     if SaveType = 1 then do
  311.         if Field = 1 then do
  312.             f= f + 1
  313.             if f = 1 then
  314.                 SaveBufferAs ILBM "VFXIFX:TempDrawer/PicA"
  315.             if f = 2 then do
  316.                 GetMain
  317.                 parse var result Name Width Height Blah
  318.                 Scale Width Height/2
  319.                 Swap
  320.                 LoadBuffer "VFXIFX:TempDrawer/PicA" Force
  321.                 Scale Width Height/2
  322.                 Hook Interlace
  323.                 SaveBufferAs ILBM SaveName""right(i,3,'0')
  324.                 f = 0
  325.                 end
  326.             end
  327.         else do
  328.             SaveBufferAs ILBM SaveName""right(i,3,'0')
  329.             end    
  330.         end
  331.  
  332. return
  333.  
  334.